home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.programming
- Path: dd.chalmers.se!news.chalmers.se!sunic!EU.net!howland.reston.ans.net!europa.eng.gtefsd.com!uunet!mnemosyne.cs.du.edu!nyx10!colin
- From: colin@nyx10.cs.du.edu (Colin Plumb)
- Subject: Re: Best way to manage memory in a text editor
- Message-ID: <1993Dec6.222518.14989@mnemosyne.cs.du.edu>
- X-Disclaimer: Nyx is a public access Unix system run by the University
- of Denver for the Denver community. The University has neither
- control over nor responsibility for the opinions of users.
- Sender: usenet@mnemosyne.cs.du.edu (netnews admin account)
- Organization: Nyx, Public Access Unix at U. of Denver Math/CS dept.
- References: <1993Dec5.171902.21420@bilver.oau.org>
- Date: Mon, 6 Dec 93 22:25:18 GMT
- Lines: 29
-
- In article <1993Dec5.171902.21420@bilver.oau.org>,
- Alex Matulich <alex@bilver.oau.org> wrote:
- >
- >Hi. I'm the author of a timed script player for titling foreign videos.
- >My users have been clamoring for a built-in editor to my software, so I
- >began writing a simple text editor to do the job.
- >
- >I soon discovered that I had several memory management options open to me,
- >and I was uncertain which was best. Certainly some were more difficult to
- >implement than others.
-
- Get a book titled _The Craft of Text Editing: Emacs for the modern world_.
- It is the definitive reference for all sorts of algorithms. It's also
- highly enlightening just to read. By Craig Finseth. MIT PRess, *I think*,
- but I might be wrong.
-
- In any case, the best general algorithm is the buffer gap. That is,
- you have a buffer of a given size, with all the text smashed up against
- the beginning and end of the buffer, with a gap where the cursor is.
- (Actually, don't move the gap until you type a character.)
-
- If the gap "fills in" and becomes zero size, you can either make the
- buffer larger, or go to a paged buffer gap, where you keep a list of
- fixed-size pages, and split and merge when they become empty and full.
-
- But get Finseth's book. It addresses *all sorts* of issues in text editor
- design.
- --
- -Colin
-